package datasv.login_datasv;

import data.datafactory.DatabaseOperator;
import po.UserPO;
import resultmessage.LoginRM;

public class AddUser {
	public static void main(String[] args) {
		System.out.println(new AddUser().addUser(new UserPO("001131011", "soft12")));
	}
	public LoginRM addUser(UserPO po){
		return addInSql(po);
	}
	private LoginRM addInSql(UserPO po){
		DatabaseOperator op=new DatabaseOperator("university_database");
		if(op.ifIDExist("userpo_list", po.getID())){
			return LoginRM.EXIST_ID;
		}
		String[][] info={{"id",po.getID()},{"password",po.getPassword()}};
		if(op.addOneRow(info, "userpo_list")){
			return LoginRM.SUCCESS;
		}
		return LoginRM.EXIST_ID;
	}
}
